package com.xidian.zhiancloud.controller.equipFacility.statistics;

import com.xidian.zhiancloud.controller.base.BaseController;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.qo.equipFacility.OhLedgerQO;
import com.xidian.zhiancloud.service.equipFacility.EquipDefendStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 设备维修统计
 *
 * @Author: Summerless
 * @Date: 2021/4/2 22:45
 */
@RestController
@RequestMapping("/EquipDefendStatistics")
public class EquipDefendStatisticsController extends BaseController {

    @Autowired
    private EquipDefendStatisticsService equipDefendStatisticsService;

    /**
     * 获取维修次数统计
     * @param qo 查询对象
     * @return 维修次数统计
     */
    @GetMapping("/getMaintenanceFrequency")
    public ResultDTO<Map> getMaintenanceFrequency(OhLedgerQO qo) {
        qo.setCompanyId(getSessionUserCompanyId());
        return ResultDTO.successOf(equipDefendStatisticsService.getMaintenanceFrequency(qo), GeneralResponseEnums.SUCCESS);
    }

    /**
     * 获取故障类型统计
     * @param qo 查询对象
     * @return 故障类型统计
     */
    @GetMapping("/getFaultTypeInfo")
    public ResultDTO<Map> getFaultTypeInfo(OhLedgerQO qo) {
        qo.setCompanyId(getSessionUserCompanyId());
        return ResultDTO.successOf(equipDefendStatisticsService.getFaultTypeInfo(qo), GeneralResponseEnums.SUCCESS);
    }

}
